package cn.cmdr.service.ServiceImpl;

import cn.cmdr.mapper.SupComMapper;
import cn.cmdr.pojo.SupCom;
import cn.cmdr.pojo.Supplier;
import cn.cmdr.service.SupComService;
import cn.cmdr.service.SupplierService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("supComService")
public class SupComServiceImpl extends ServiceImpl<SupComMapper, SupCom> implements SupComService {
    @Resource
    private SupComMapper supComMapper;
    @Override
    public List<SupCom> getSupCom(Integer supplierId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(supplierId!=null,"supplier_id",supplierId);
        return supComMapper.selectList(queryWrapper);
    }

    @Override
    public List<SupCom> getList(Integer supplierId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq(supplierId!=null,"supplier_id",supplierId);
        return supComMapper.getList(queryWrapper);
    }

    @Override
    public void add(SupCom supCom) {
        supComMapper.insert(supCom);
    }

    @Override
    public void update(SupCom supCom) {
        supComMapper.updateById(supCom);
    }

    @Override
    public void delete(Integer id) {
        supComMapper.deleteById(id);
    }
}
